#!/bin/bash

echo '创建文件'
mkdir -p volume/es/{data,plugins,logs} &&
  chown -R 1000:0 volume/es

echo '开放端口'
firewall-cmd --zone=public --add-port=9200/tcp --permanent
firewall-cmd --zone=public --add-port=9300/tcp --permanent

firewall-cmd --zone=public --add-port=9100/tcp --permanent

firewall-cmd --zone=public --add-port=5601/tcp --permanent

firewall-cmd --zone=public --add-port=11800/tcp --permanent
firewall-cmd --zone=public --add-port=12800/tcp --permanent

firewall-cmd --zone=public --add-port=18080/tcp --permanent
firewall-cmd --reload

echo '启动容器'
docker-compose up -d

echo '安装分词器'
docker exec -it elasticsearch elasticsearch-plugin install file:///es/plugins/elasticsearch-analysis-ik.zip

echo '查看容器'
docker-compose ps
